package Communication;

import java.io.Serializable;
import java.util.ArrayList;

public class MessageHandle extends ArrayList  {

	/**
	 * 
	 */
	private static final long serialVersionUID = 42L;
	public static final int CUSTOMER = 1;
	public static final int WORKER_STATUS = 2;
	public static final int INSERT_PRODUCT = 3;
	public static final int CATEGORY = 4; 
	public static final int COMMENT_REPORT = 5;
	public static final int REPORT = 6;
	public static final int CUSTOMER_REPORT = 7;
	public static final int SALE = 8;
	public static final int CATEGORY_PRODUCT = 9; 
	public static final int PATTERN = 10;
	public static final int ADD_CUSTOMER = 11;		
	public static final int UPDATE_GET_CUSTOMER = 12;	
	public static final int WORKER = 13;
	public static final int CONFIG = 14;
	public static final int PRODUCT = 15;
	public static final int PACKAGE_REQUEST = 16;
	public static final int CATALOG = 17;
	public static final int HANDLE_SALE = 18;
	public static final int CITY = 19;
	public static final int GET_CITIES =20;
	public static final int ADD_CITY =21;
	public static final int DELETE_CITY =22;
	public static final int UPDATE_GET_CUSTOMER_HISTORY =23;
	public static final int PATTERN_FOR_SALE =24;
	public static final int GET_CUSTOMERS =25;
	public static final int GET_PRODUCTS =26;
	
	

	
	private Object data;
	private int type;
	private boolean updateDB;
	private String msg;
	/**
	 * 
	 * @return  msg
	 */
	public String getMsg() {
		return msg;
	}
/**
 * 
 * @param msg
 */
	public void setMsg(String msg) {
		this.msg = msg;
	}
/**
 * Handle the given message.
 * @param data- the object to be handled
 * @param type- type of the message to be handled
 * @param updateDB
 */
	public MessageHandle(Object data, int type, boolean updateDB) {
		this.data = data;
		this.type = type;
		this.updateDB = updateDB;
	}
	/**
	 * Handle the given message.
	 * @param data
	 * @param type
	 * @param updateDB
	 */
	public MessageHandle(String data, int type, boolean updateDB) {
		this.data = data;
		this.type = type;
		this.updateDB = updateDB;
	}
	/**
	 * 
	 * @return data
	 */
	public Object getData() {
		return data;
	}
	/**
	 * get the type of the Message (Each message is number)
	 * @return type
	 */
	public int getType() {
		return type;
	}
	/**
	 * 
	 * @return updateDB
	 */
	public boolean isUpdateDB() {
		return updateDB;
	}
	/**
	 * 
	 * @param data -the object we handle with
	 */
	public void setData(Object data) {
		this.data = data;
	}
	/**
	 * 
	 * @param type -number of the type Message
	 */
	public void setType(int type) {
		this.type = type;
	}
	/**
	 * 
	 * @param updateDB (if its true =update the database if false= don't update the database)
	 */
	public void setUpdateDB(boolean updateDB) {
		this.updateDB = updateDB;
	}
}


